]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Add event blocker inhibition API
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 28 Jun 2019 22:44:20 +0000 (19:44 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 8 Aug 2019 12:09:46 +0000 (09:09 -0300)
The event blocker is an actor that is added in between the
icon grid and the app folder popup in order to guarantee
that clicking outside the app folder will collapse it.

However, the next patch will require allowing dragging events
to be passed to folder icons, and the event blocker gets in
our way here, preventing drag n' drop to work properly.

Add an API to inhibit the event blocker. This API will be
used by the app folders while an item is dragged.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/664

js/ui/appDisplay.js

index b2cdb3d9de8fbc72740d92876541593ce3fa6a99..6bd3b1398b854d8d4e377b10a3a0d5ecafb5ad37 100644 (file)
@@ -326,6 +326,8 @@ var AllView = class AllView extends BaseAppView {
         this._folderSettings.connect('changed::folder-children', () => {
             Main.queueDeferredWork(this._redisplayWorkId);
         });
+
+        this._nEventBlockerInhibits = 0;
     }
 
     _redisplay() {
@@ -668,6 +670,19 @@ var AllView = class AllView extends BaseAppView {
         for (let i = 0; i < this.folderIcons.length; i++)
             this.folderIcons[i].adaptToSize(availWidth, availHeight);
     }
+
+    inhibitEventBlocker() {
+        this._nEventBlockerInhibits++;
+        this._eventBlocker.visible = this._nEventBlockerInhibits == 0;
+    }
+
+    uninhibitEventBlocker() {
+        if (this._nEventBlockerInhibits === 0)
+            throw new Error('Not inhibited');
+
+        this._nEventBlockerInhibits--;
+        this._eventBlocker.visible = this._nEventBlockerInhibits == 0;
+    }
 };
 Signals.addSignalMethods(AllView.prototype);